package com.miaoxie.forum.module.framework.server.dao.impl;

import com.miaoxie.forum.module.auth.shared.dao.BiBaseDao;
import com.miaoxie.forum.module.framework.server.dao.IWebIMDao;
import com.miaoxie.forum.module.framework.shared.entity.Users;
import org.springframework.stereotype.Repository;

import java.util.List;


/**
 * Created by miaoxie on 2017/2/21.
 */
@Repository
public class WebIMDao extends BiBaseDao implements IWebIMDao {
    private static final String MAPPER_URL ="com.miaoxie.module.monitor.mobitordao.";
    public Integer getCount(){
        Integer a = getSqlSession().selectOne(buildStatement(MAPPER_URL,"queryCompleteFastest"));
        return a;
    }

    /**
     * 登录
     *
     * @param qq
     * @param username
     * @param pwd
     * @return
     */
    @Override
    public Users login(String qq, String username, String pwd) {
        List<Users> list = getSqlSession().selectList(buildStatement(MAPPER_URL,"login"),getParamsBuilder().put("name",username)
                .put("pwd",pwd).build());
        return list.size()>0?list.get(0):null;
    }

    @Override
    public Object testcon() {
        return getSqlSession().selectList(buildStatement("com.miaoxie.module.mobile.server.webIMDao","testcon"));
    }
}
